﻿// This code is released under the BSD license.
namespace PugLib.UnitTest
{
    #region

    using System.Drawing;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Net;

    #endregion

    /// <summary>
    ///This is a test class for IdenticonUtilTest and is intended
    ///to contain all IdenticonUtilTest Unit Tests
    ///</summary>
    [TestClass]
    public class IdenticonUtilTest
    {
        /// <summary>
        ///A test for Code
        ///</summary>
        [TestMethod]
        public void IdenticodeTest()
        {
            int code = Identicons.Code(FindIP.FirstIpv4NonLoopback);
            const int dimension = 1024;
            IdenticonRenderer render = new IdenticonRenderer(dimension);
            Bitmap rtn = render.Render(code);
            Assert.IsTrue(rtn != null && rtn.Width == dimension && rtn.Height == dimension);
            //string file = Path.GetTempFileName() + ".bmp";
            //rtn.Save(file);

            //using (Process otherProcess = new Process())
            //{
            //    otherProcess.StartInfo.FileName = file;
            //    otherProcess.StartInfo.Verb = "Open";
            //    otherProcess.StartInfo.CreateNoWindow = true;
            //    otherProcess.StartInfo.UseShellExecute = true;
            //    otherProcess.Start();
            //}
        }
    }
}